package com.chinairi.mall.controller;

import com.chinairi.common.annotation.DoPage;
import com.chinairi.common.controller.BaseController;
import com.chinairi.mall.controller.viewobject.ReplaceInfoParam;
import com.chinairi.mall.controller.viewobject.SuggestionPlanParam;
import com.chinairi.mall.model.ReqModelDetail;
import com.chinairi.mall.service.IReqModelDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 模型明细控制器，完成增、删、改、查等操作
 * </p>
 * @author 李昌赐
 * @since 2020-08-19
 */
@Api(tags = "模型明细")
@RestController
@RequestMapping("req-model-detail")
public class ReqModelDetailController extends BaseController {

    private static final long serialVersionUID = 1097039551817429491L;

    @Autowired
    private IReqModelDetailService reqModelDetailService;

    @ApiOperation("模型明细分页查询")
    @GetMapping
    public List<Map<String, Object>> pageReqModelDetail(ReqModelDetail reqModelDetail) {
        return reqModelDetailService.pageReqModelDetail(reqModelDetail);
    }

    @ApiOperation("保存模型明细")
    @PostMapping
    public Map<String, Object> saveReqModelDetail(@RequestBody ReqModelDetail reqModelDetail) {
        return reqModelDetailService.saveReqModelDetail(reqModelDetail);
    }

    @ApiOperation("模型明细查询")
    @GetMapping("reqModelDetail")
    public Map<String, Object> getReqModelDetail(String modelDetailId) {
        return reqModelDetailService.getReqModelDetail(modelDetailId);
    }

    @ApiOperation("修改模型明细")
    @PutMapping
    public Map<String, Object> updateReqModelDetail(@RequestBody ReqModelDetail reqModelDetail) {
        return reqModelDetailService.updateReqModelDetail(reqModelDetail);
    }

    @ApiOperation("删除模型明细")
    @DeleteMapping("/{modelDetailId}")
    public Map<String, Object> deleteReqModelDetail(@PathVariable String modelDetailId) {
        return reqModelDetailService.deleteReqModelDetail(modelDetailId);
    }

    @ApiOperation("井号下拉")
    @GetMapping("listWellNumber")
    public List<Map<String, Object>> listWellNumber() {
        return reqModelDetailService.listWellNumber();
    }

    @ApiOperation("井别下拉")
    @GetMapping("listWellClassification")
    public List<Map<String, Object>> listWellClassification() {
        return reqModelDetailService.listWellClassification();
    }

    @ApiOperation("井型下拉")
    @GetMapping("listWellType")
    public List<Map<String, Object>> listWellType() {
        return reqModelDetailService.listWellType();
    }

    @ApiOperation("工区下拉")
    @GetMapping("listWorkArea")
    public List<Map<String, Object>> listWorkArea() {
        return reqModelDetailService.listWorkArea();
    }

    /**
     * 获取代用情况信息
     * @param replaceInfoParam
     * @return
     */
    @GetMapping("/ReplaceInfo")
    public List<Map<String,Object>> getReplaceInfo(ReplaceInfoParam replaceInfoParam){
        return reqModelDetailService.getReplaceInfo(replaceInfoParam);
    }
    /**
     * 获取最大最小消耗量
     * @param conNum
     * @return
     */
    @GetMapping("/getConNum")
    public List<Map<String,Object>> getConNum(String conNum){
        return reqModelDetailService.getConNum(conNum);
    }

    /**
     * 建议计划查询
     * @param suggestionPlanParam
     * @return
     */
    @GetMapping("/getSuggestionPlanInfo")
    @DoPage
    public List<Map<String,Object>> getSuggestionPlanInfo(SuggestionPlanParam suggestionPlanParam){
        return reqModelDetailService.getSuggestionPlanInfo(suggestionPlanParam);
    }
}
